<?php 
namespace app\home\validate;
use think\Validate;

class Member extends Validate
{
	protected $rule=[
		'username'=>'require|unique:member,username,id',
		'pwd'=>'require|length:6,16',
		'pwd_confirm'=>'require|confirm',
		'name'=>'require|unique:member,name,id',
		'phone'=>'require|length:11|unique:member,phone,id',
		'email'=>'require|email',
		'checkcode'=>'require|captcha',
		'agree'=>'require',
	];
	protected $message=[
		'username'=>[
			'require'=>'用户名必须填写',
			'unique'=>'用户名已存在',
		],
		'name'=>[
			'require'=>'姓名必须填写',
			'unique'=>'姓名已存在',
		],
		'pwd'=>[
			'require'=>'密码必须填写',
			'length'=>'密码长度为6到16位',
		],
		'pwd_confirm'=>[
			'require'=>'确认密码必须填写',
			'confirm'=>'两次密码输入不一致',
		],
		'phone'=>[
			'require'=>'手机号必须填写',
			'length'=>'手机格式不正确',
			'unique'=>'手机号已存在',
		],
		'email'=>[
			'require'=>'邮箱必须填写',
			'email'=>'邮箱格式不正确',
		],
		'checkcode'=>[
			'require'=>'验证码必须填写',
			'captcha'=>'验证码输入错误',
		],
		'agree'=>[
			'require'=>'条款必须勾选',
		],
	];
}